AS	=as --gstabs --32
LD	=ld -m elf_i386 -Ttext 0x0000 -g
LDFLAGS	=-s -x #-M
CC	=gcc $(RAMDISK)
CFLAGS	=-m32 -Wall -O -fstrength-reduce -fomit-frame-pointer \
	-finline-functions -nostdinc -I../include -fno-stack-protector \
	-fno-builtin -O0
CPP	=gcc -E -nostdinc -I../include

.c.s:
	$(CC) $(CFLAGS) \
	-nostdinc -Iinclude -S -o $*.s $<
.s.o:
	$(AS) -c -o $*.o $<
.c.o:
	$(CC) $(CFLAGS) \
	-nostdinc -Iinclude -c -o $*.o $<

OBJS  = vsprintf.o traps.o asm.o sched.o sys_call.o \
	signal.o panic.o printk.o

kernel.o: $(OBJS)
	$(LD) -r -o kernel.o $(OBJS)
	@sync

clean:
	@rm -f *.o
	(cd chr_drv; make clean)
	(cd math; make clean)
	(cd blk_drv; make clean)

### Dependencies:
vsprintf.s vsprintf.o : vsprintf.c ../include/stdarg.h ../include/string.h
traps.s traps.o : traps.c ../include/string.h ../include/linux/sched.h \
	../include/asm/system.h ../include/asm/io.h ../include/linux/head.h
sched.s sched.o : sched.c ../include/linux/sched.h ../include/linux/head.h \
	../include/asm/system.h ../include/linux/sys.h 
signal.s signal.o : signal.c ../include/linux/sched.h ../include/linux/head.h \
	../include/linux/fs.h ../include/sys/types.h ../include/linux/mm.h
panic.s panic.o : panic.c ../include/linux/kernel.h ../include/linux/sched.h
printk.s printk.o : printk.c ../include/stdarg.h ../include/stddef.h \
  ../include/linux/kernel.h 